package com.example.su_shi_tan_wallet

import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.appcompat.widget.Toolbar
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.example.su_shi_tan_bas_lib.base.BaseFragmentEx
import com.example.su_shi_tan_bas_lib.base.BaseLazyDataBindingFragment
import com.example.su_shi_tan_bas_lib.glidmodule.GlideApp
import com.example.su_shi_tan_core.arouter.WalletARouter
import com.example.su_shi_tan_core.arouter.WalletARouterParams
import com.example.su_shi_tan_core.constant.SignUserBeanHolder
import com.example.su_shi_tan_core.extentions.castBaseFragmentEx
import com.example.su_shi_tan_core.utils.clipboard
import com.example.su_shi_tan_wallet.databinding.CollectionsFragmentBinding

/**
 * 收款
 * */
@Route(path = WalletARouter.CollectionsFragment)
class CollectionsFragment : BaseLazyDataBindingFragment<CollectionsFragmentBinding>(),
    View.OnClickListener {


    @JvmField
    @Autowired(name = WalletARouterParams.tokenType)
    var tokenType: String = ""

    override fun layoutId(): Int {
        return R.layout.collections_fragment
    }

    override fun lazyInit() {

    }

    override fun initView(view: View) {

        val mToolbar: Toolbar = view.findViewById(R.id.mToolbar)
        mToolbar.title = "收款"
        mToolbar.setNavigationOnClickListener { onBackPressedSupport() }

        viewBinder.userInfo = SignUserBeanHolder.getSignUser()
        viewBinder?.onViewClick = this

        loadRootFragment(
            R.id.wallet_header,
            ARouter.getInstance()
                .build(WalletARouter.WalletHeaderFragment)
                .withString(WalletARouterParams.tokenType, tokenType)
                .castBaseFragmentEx()
        )
    }

    override fun onClick(v: View?) {
        when(v?.id){
            R.id.mCopyTv->{
                val walletAddress = SignUserBeanHolder.getSignUser()?.wallet_address?:""
                clipboard("", walletAddress)
            }
        }
    }


}